package hk.edu.cityu.is.riskmgmt.servlet;

import org.apache.log4j.Logger;
import org.jfree.util.Log;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ConfigurationServlet
 */
public class ConfigurationServlet extends HttpServlet {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger
			.getLogger(ConfigurationServlet.class);

	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public ConfigurationServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out = response.getWriter();
		String bank = request.getParameter("Bank");
		String country = request.getParameter("country");
		String numberofbank = request.getParameter("numberofbank");
		String fxset = request.getParameter("fxset");
		String irset = request.getParameter("irset");
		String stockset = request.getParameter("stockset");
		String fxusd = request.getParameter("fxusd");
		String fxjpy = request.getParameter("fxjpy");
		String fxchf = request.getParameter("fxchf");
		String fxgbp = request.getParameter("fxgbp");
		String fxeur = request.getParameter("fxeur");
		String irusd = request.getParameter("irusd");
		String irjpy = request.getParameter("irjpy");
		String irchf = request.getParameter("irchf");
		String irgbp = request.getParameter("irgbp");
		String ireur = request.getParameter("ireur");
		String totalsecurities = request.getParameter("totalsecurities");
		String shockrate = request.getParameter("shock_rate");
		String capitalinjectionratio = request
				.getParameter("capitalinjectionratio");
		String cpv = request.getParameter("cpv");
		String pricing = request.getParameter("stockprice");
		String datasource = request.getParameter("datasource");
		String outflows = request.getParameter("outflows");
		out.println(bank + ", " + country + ", " + numberofbank + ", " + fxset
				+ ", " + irset + ", " + stockset + ", " + fxusd + ", " + fxeur
				+ ", " + fxgbp + ", " + fxchf + ", " + fxjpy + ", " + irusd
				+ ", " + irchf + ", " + irjpy + ", " + ireur + ", " + irgbp
				+ ", " + totalsecurities + ", " + shockrate + ", "
				+ capitalinjectionratio + ", " + cpv + ", " + pricing + ", "
				+ datasource);
		Log.info(bank + ", " + country + ", " + numberofbank + ", " + fxset
				+ ", " + irset + ", " + stockset + ", " + fxusd + ", " + fxeur
				+ ", " + fxgbp + ", " + fxchf + ", " + fxjpy + ", " + irusd
				+ ", " + irchf + ", " + irjpy + ", " + ireur + ", " + irgbp
				+ ", " + totalsecurities + ", " + shockrate + ", "
				+ capitalinjectionratio + ", " + cpv + ", " + pricing + ", "
				+ datasource);

	}

}
